package com.extract.task.basic;

import lombok.*;

import java.util.Objects;

/**
 * 任务结果
 *
 * @author: chenfenghai
 * @version: 1.0
 * @date: 2020-10-15 10:10
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode
@ToString
public class TaskResult {

    public static final String SUCCESS_CODE = "0";
    public static final String FAILURE_CODE = "1";

    /**
     * 结果编码
     */
    private String code;

    /**
     * 最后标记
     */
    private String lastSign;

    /**
     * 处理记录数量
     */
    @Builder.Default
    private int handlerNum = 0;

    /**
     * 是否成功
     *
     * @return boolean
     */
    public boolean isSuccess(){
        return Objects.equals(code, SUCCESS_CODE);
    }
}
